package com.yingside.io.io;

import java.io.IOException;
import java.io.InputStream;
import java.util.Scanner;

public class TestSystemin {
    public static void main(String[] args) {
        //System.in就是所谓的标准流，其实就是一个InputSteam
        //只是这个System.in可以直接读取到我们在console窗口中输入的内容
        System.out.println("请输入内容:");
        InputStream in = System.in;

        byte [] bs = new byte[1024];
        int n = -1;

        try {
            while((n = in.read(bs)) != -1){
                String str = new String(bs,0,n);
                System.out.println("str = " + str);

                if(str.trim().equals("exit")){
                    break;
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                in.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    }
}

